#include "stats.h"
#include "misc.h"

namespace stats {
    int getAttack(int rlevel, RobotType type) {
        int level = rlevel + levelBias;
        double attack;
        attack = BaseAttack * pow(level, AttackExp);
        if (type == RobotType::AttackRobot)
            attack *= 2;
        return int(attack + EPS);
    }

    int getMaxHP(int rlevel, RobotType type) {
        int level = rlevel + levelBias;
        double hp = BaseHP * pow(level, HPExp);
        if (type == DefenseRobot)
            hp *= 2;
        return int(hp + EPS);
    }

    int getDefense(int rlevel, RobotType type) {
        int level = rlevel + levelBias;
        double defense = BaseDefense * pow(level, DefenseExp);
        return int(defense + EPS);
    }

    int getConsumption(int rlevel) {
        int level = rlevel + levelBias;
        double consumption = BaseConsumption * pow(level, ConsumptionExp);
        return int(consumption + EPS);
    }

    int getLevelUPConsumption(int rlevel) {
        return (getConsumption(rlevel) * 20);
    }

    int getEfficiency(int rlevel, RobotType type) {
        int level = rlevel + levelBias;
        double efficiency = BaseEfficiency * pow(level, EfficiencyExp);
        if (type == GatherRobot)
            efficiency *= 2;
        return int(efficiency + EPS);
    }

    int getCapacity(int rlevel, RobotType type) {
        return getEfficiency(rlevel, type) * 30;
    }
}